package mess;

public class LeeCode_03 {
    public static void main(String[] args) {
        /*String s = "abcabcbb";
        String s1 = "bbbb";
        String s2 = "pwwkew";
        String s3 = "abcdefgg";
        System.out.println(lengthOfLongestSubstring("au"));*/
        int start = 3;
        int end = 3;
        int index = 'A';
        for (int i = 0; i < 4; i++) {
            for (int j = 0; j < 7; j++) {
                if (j >= start && j <= end){
                    System.out.print((char) index);
                    index++;
                    continue;
                }
                System.out.print(" ");
            }
            start--;
            end++;
            System.out.println();
        }
    }

    private static int lengthOfLongestSubstring(String s) {
        if (s.equals("")){
            return 0;
        }
        int len = s.length();
        int start;
        int end;
        int count = 0;
        for (int i = len; i > 0; i--) {
            start = -1;
            for (int m = 0; m <= count; m++) {
                start += 1;
                end = start + i;
                String temp = s.substring(start,end);
                outer : for (int j = 0; j < temp.length(); j++) {
                    char c = temp.charAt(j);
                    for (int k = j + 1; k < temp.length(); k++) {
                        if (c == temp.charAt(k)){
                            break outer;
                        }
                    }
                    if (j == temp.length() - 1){
                        return temp.length();
                    }
                }
            }
            count++;
        }
        return 1;
    }
}
